import React from "react";
import CommService from "@/data/index"
import PropTypes from "prop-types"
import { withRouter } from "react-router-dom";
function SeriesItem(props){
    const {sname,dataId,name, history}=props
    function  serviceModels(series_id){
        history.push(`/model?id=${series_id}`)
        /*
        CommService['serviceModels']({series_id}).then(res=>{
            console.log(res);
           
            //    {"reason":"success","result":[{"id":"48527","series_id":"4175","name":"2022款 35 TFSI 进取型","year":"2022","peizhi":""},{"id":"48528","series_id":"4175","name":"2022款 40 TFSI 时尚型","year":"2022","peizhi":""},{"id":"48529","series_id":"4175","name":"2022款 40 TFSI RS套件燃速型","year":"2022","peizhi":""},{"id":"48530","series_id":"4175","name":"2022款 45 TFSI quattro 时尚型","year":"2022","peizhi":""},{"id":"48531","series_id":"4175","name":"2022款 45 TFSI quattro 豪华型","year":"2022","peizhi":""},{"id":"39481","series_id":"4175","name":"2021款 40 TFSI 进享人生版","year":"2021","peizhi":""},{"id":"35826","series_id":"4175","name":"2020款 35 TFSI 进取型","year":"2020","peizhi":"1.4升 涡轮增压 150马力 国VI"},{"id":"35827","series_id":"4175","name":"2020款 40 TFSI 时尚型","year":"2020","peizhi":"2.0升 涡轮增压 186马力 国VI"},{"id":"35828","series_id":"4175","name":"2020款 45 TFSI quattro 时尚型","year":"2020","peizhi":"2.0升 涡轮增压 220马力 国VI"},{"id":"35829","series_id":"4175","name":"2020款 45 TFSI quattro 豪华型","year":"2020","peizhi":"2.0升 涡轮增压 220马力 国VI"},{"id":"35830","series_id":"4175","name":"2020款 45 TFSI quattro 定制尊享版","year":"2020","peizhi":"2020款(停售)"}],"error_code":0}
            
        })
        */
    }

    return(
        <li onClick={()=>serviceModels(dataId)}>
            <div className="bold">{name}</div>
            <div className="c-999">{sname}</div>
        </li>
    )
}
SeriesItem.defaultProps={
    sname:"",
    dataId:"",
    name:"",
    history:{}
}
SeriesItem.propTypes={
    sname:PropTypes.string,
    dataId:PropTypes.string,
    name:PropTypes.string,
    history:PropTypes.object
}
export default withRouter(SeriesItem);